package com.woniu.liuzhougov.relatedinformation.controller.impl;

import com.woniu.liuzhougov.businessproject.vo.BusinessProjectUploadVO;
import com.woniu.liuzhougov.businessproject.vo.Result;
import com.woniu.liuzhougov.fileManage.constant.SysConstant;
import com.woniu.liuzhougov.relatedinformation.controller.AbstractRelatedInformationController;
import com.woniu.liuzhougov.relatedinformation.controller.RelatedInformationController;
import com.woniu.liuzhougov.relatedinformation.pojo.ContactInformation;
import com.woniu.liuzhougov.relatedinformation.pojo.RelatedInformation;
import com.woniu.liuzhougov.relatedinformation.service.RelatedInformationService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;

/**
 * @Description: desc
 * @author: Chris
 * @createDate: 2019/4/24 0024
 * @version: 1.0
 */
@Controller
@RequestMapping("/contactInformation")
public class ContactInformationController extends AbstractRelatedInformationController<ContactInformation> implements RelatedInformationController<ContactInformation> {

    @Resource(name = "contactInformationService")
    private RelatedInformationService contactInformationService;

    @Override
    @RequestMapping("list")
    @ResponseBody
    @RequiresPermissions(value = "contactInformation_listContactinformations")
    public Result list() {
        return parentList(contactInformationService);
    }

    @Override
    @RequestMapping("search")
    @ResponseBody
    @RequiresPermissions(value = "contactInformation_searchContactinformation")
    public Result search(String name) {
        return parentSearch(contactInformationService,name);
    }

    @Override
    @RequestMapping("delete")
    @ResponseBody
    @RequiresPermissions(value = "contactInformation_deleteContactinformation")
    public Result delete(Integer[] deletelist) {
        return parentDelete(contactInformationService,deletelist);
    }

    @Override
    @RequestMapping("add")
    @ResponseBody
    @RequiresPermissions(value = "contactInformation_addContactinformation")
    public Result add(ContactInformation contactInformation) {
        return parentAdd(contactInformationService,contactInformation);
    }

    @Override
    @RequestMapping("update")
    @ResponseBody
    @RequiresPermissions(value = "contactInformation_updateContactinformation")
    public Result update(ContactInformation contactInformation) {
        return parentUpdate(contactInformationService,contactInformation);
    }

    @Override
    @RequestMapping("initForm")
    @ResponseBody
    @RequiresPermissions(value = "contactInformation_updateContactinformation")
    public Result initForm(Integer id) {
        return parentInitForm(contactInformationService,id);
    }

    @Override
    @RequestMapping("/upload")
    @ResponseBody
    @RequiresPermissions(value = "file_upload")
    public com.woniu.liuzhougov.common.utils.Result upload(MultipartFile file, HttpServletRequest request) throws IOException, IllegalStateException {
        return parentUpload(contactInformationService,file,request);
    }

    @Override
    @RequestMapping("/addFile")
    @ResponseBody
    @RequiresPermissions(value = "file_upload")
    public com.woniu.liuzhougov.common.utils.Result addFile(RelatedInformation fileData) {
        return parentAddFile(fileData);
    }

}
